package L5;
import java.util.Scanner;
import java.util.InputMismatchException;
class Triangle {
	private double a;
	private double b;
	private double c;
	Triangle(double a, double b, double c) {
		this.a = a;
		this.b = b;
		this.c = c;
		if (this.getArea() == 0)
			throw new RuntimeException("Not a triangle!");
	}
	
	public double getArea() {
        double p = (a+b+c)/2.0;
        return Math.sqrt(p*(p-a)*(p-b)*(p-c));
    }
	
}

public class TestTriangleAgain {
	public static void main(String[] argv) {
		Scanner sc = new Scanner(System.in);
		try {
			Triangle triangle = new Triangle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble());
			System.out.println("Enter sides of triangle:\nArea: "+triangle.getArea());
		} catch (InputMismatchException e) {
			System.out.println("Error, not all numbers!");
		} catch (RuntimeException e) {
			System.out.println(e.getMessage());
		}
		sc.close();
	}
}
